<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        category: [
          "D1",
          "D2",
          "D3",
          "D4",
          "D5",
          "D6",
        ],
        aoiData: [
          95.3,
          92.3,
          91.3,
          96.3,
          93.62,
          97.2
          /*0.953,
          0.923,
          0.913,
          0.963,
          0.9362,
          0.972*/
        ],
        volData: [
          92.32,
          93.16,
          94.3,
          95.3,
          97.62,
          93.28
          /*0.923,
          0.933,
          0.943,
          0.953,
          0.9762,
          0.932*/
        ],
        ateData: [
          94.13,
          96.23,
          92.67,
          93.21,
          98.62,
          91.27
          /*0.943,
          0.963,
          0.923,
          0.933,
          0.9862,
          0.912*/
        ],
        rateData: [
                99.2,
                92.13,
                96.3,
                91.3,
                93.5,
                96.2
        ]
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        //let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        let rate = this.cdata.aoiData[i] / this.cdata.ateData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  }
};
</script>

<style lang="scss" scoped>
</style>
